import {Column} from "@antv/g2plot";

export const L2Info = [
  {
    title: "当日人流量",
    key: "dqrll"
  },
  {
    title: "当前园区人数",
    key: "dqygs"
  },
];

export const R2Col = [
  {
    type: "小型车",
    key: "xxcl",
  },
  {
    type: "大型车",
    key: "dxcl",
  },
  {
    type: "其他车",
    key: "qtcl",
  },
];

let chartInstance = null;

export const createChartNewR2 = (el, data) => {

  if (chartInstance) {
    chartInstance?.destroy();
  }
  chartInstance = new Column(el, {
    forceFit: true,
    padding: [20, 0, 30, 30],
    data,
    xField: "type",
    yField: "value",
    columnStyle: {
      fill: "l(270) 0:#B7FFFF 1:#B7FFFF",
    },
    xAxis: {
      label: {
        offsetY: 5,
        style: {
          fill: "#ffffff",
        },
      },
      line: null,
      tickLine: null,
      title: null,
    },
    yAxis: {
      label: {
        style: {
          fill: "#B7FFFF",
        },
      },
      grid: null,
      title: null,
    },
    label: {
      visible: true,
      position: "top",
      offsetY: 8,
      style: {
        fill: "#ffffff",
      },
    },
    minColumnWidth: 30,
    maxColumnWidth: 30,
  });

  chartInstance.render();
};

